package com.minova.demo.service.impl;

import com.minova.demo.entity.TzProdComm;
import com.minova.demo.mapper.TzProdCommMapper;
import com.minova.demo.service.ITzProdCommService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品评论 服务实现类
 * </p>
 *
 * @author linrongji
 * @since 2019-12-23
 */
@Service
public class TzProdCommServiceImpl extends ServiceImpl<TzProdCommMapper, TzProdComm> implements ITzProdCommService {

	@Autowired
	TzProdCommMapper tzProdCommMapper;
	
	@Override
	public int getGoodRate(int prodid) {
		// TODO Auto-generated method stub
		return tzProdCommMapper.getGoodRate(prodid);
	}

	@Override
	public IPage<TzProdComm> selectPageVo(String prodid, int page, int size, String byDesc) {
		 Page<TzProdComm> pages = new Page<>(page, size);
	        return tzProdCommMapper.selectPage(pages, new QueryWrapper<TzProdComm>()
	                .eq("prod_id", prodid).orderByDesc(byDesc));
	}
	
}
